﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace APPLICATION.Dict.Post
{
    public partial class FrmPost : Form
    {
        public FrmPost()
        {
            InitializeComponent();
        }

        
        private void FrmPost_Load(object sender, EventArgs e)
        {
            
            this.dtPostTableAdapter1.Fill(this.tIMSDataSet.dtPost);
            this.treeList1.DataSource = this.dtPostBindingSource;
        }
        
        private void btnAdd_Click(object sender, EventArgs e)
        {
            globals.UpdKey = 0;
            FrmPostDetail frm = new FrmPostDetail();
            frm.ShowDialog(this);
            frm.Dispose();
        }

        private void btnEdit_Click(object sender, EventArgs e)
        {
            globals.UpdKey = 1;
            globals.pCodeID = Convert.ToInt32((object)this.treeList1.Selection[0].GetValue("CodeID"));
            FrmPostDetail frm = new FrmPostDetail();
            frm.ShowDialog(this);
            frm.Dispose();
        }

        private void btnDelete_Click(object sender, EventArgs e)
        {
            globals.UpdKey = 2;
            globals.pCodeID = Convert.ToInt32((object)this.treeList1.Selection[0].GetValue("CodeID"));
            FrmPostDetail frm = new FrmPostDetail();
            frm.ShowDialog(this);
            frm.Dispose();
        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            this.tIMSDataSet.dtPost.Clear();
            this.dtPostTableAdapter1.Fill(this.tIMSDataSet.dtPost);
            this.treeList1.DataSource = this.dtPostBindingSource;
        }

        private void FrmPost_Activated(object sender, EventArgs e)
        {
            this.tIMSDataSet.dtPost.Clear();
            this.dtPostTableAdapter1.Fill(this.tIMSDataSet.dtPost);
            this.treeList1.DataSource = this.dtPostBindingSource;
        }
    }
}
